// ==========================================================================
// GFast自动生成controller操作代码。
// 生成日期：2024-06-11 17:40:12
// 生成路径: internal/app/app/controller/app_user.go
// 生成人：yxfmlbb
// desc:用户表
// company:云南奇讯科技有限公司
// ==========================================================================

package controller

import (
	"context"

	"github.com/tiger1103/gfast/v3/api/v1/app"
	"github.com/tiger1103/gfast/v3/internal/app/app/service"
	systemController "github.com/tiger1103/gfast/v3/internal/app/system/controller"
)

type appUserController struct {
	systemController.BaseController
}

var AppUser = new(appUserController)

// List 列表
func (c *appUserController) List(ctx context.Context, req *app.AppUserSearchReq) (res *app.AppUserSearchRes, err error) {
	res = new(app.AppUserSearchRes)
	res.AppUserSearchRes, err = service.AppUser().List(ctx, &req.AppUserSearchReq)
	return
}

// Get 获取用户表
func (c *appUserController) Get(ctx context.Context, req *app.AppUserGetReq) (res *app.AppUserGetRes, err error) {
	res = new(app.AppUserGetRes)
	res.AppUserInfoRes, err = service.AppUser().GetById(ctx, req.Id)
	return
}

// Add 添加用户表
func (c *appUserController) Add(ctx context.Context, req *app.AppUserAddReq) (res *app.AppUserAddRes, err error) {
	err = service.AppUser().Add(ctx, req.AppUserAddReq)
	return
}

// Edit 修改用户表
func (c *appUserController) Edit(ctx context.Context, req *app.AppUserEditReq) (res *app.AppUserEditRes, err error) {
	err = service.AppUser().Edit(ctx, req.AppUserEditReq)
	return
}

// Delete 删除用户表
func (c *appUserController) Delete(ctx context.Context, req *app.AppUserDeleteReq) (res *app.AppUserDeleteRes, err error) {
	err = service.AppUser().Delete(ctx, req.Ids)
	return
}
